package com.gzlg.hospital.dao;

import com.gzlg.hospital.pojo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;
import java.util.Map;

@Mapper
@Repository
public interface AdminDao {
    Admin adminlogin(String account);

    // 医生管理
    List<Doctor> findAllDoctors();
    Doctor findDoctorById(Integer id);
    void saveDoctor(Doctor doctor);
    void updateDoctor(Doctor doctor);
    void deleteDoctorById(Integer id);
    List<Doctor> findDoctorsByNameAndIdCard(@Param("name") String name, @Param("id_card") String idCard);

    //患者管理
    List<Patient> findAllPatients();
    Patient findPatientById(Integer id);
    void savePatient(Patient patient);
    void updatePatient(Patient patient);
    void deletePatientById(Integer id);
    List<Patient> findPatientsByNameAndIdCard(@Param("name") String name, @Param("id_card") String id_card);

    // 药品管理
    List<Pharmaceutical> findAllPharmaceuticals();
    Pharmaceutical findPharmaceuticalById(Integer id);
    void savePharmaceutical(Pharmaceutical pharmaceutical);
    void updatePharmaceutical(Pharmaceutical pharmaceutical);
    void deletePharmaceuticalById(Integer id);
    List<Pharmaceutical> findPharmaceuticalsByNameAndManufacturer(@Param("name") String name, @Param("manufacturer") String manufacturer);

    //检查项目管理
    List<CheckItem> findAllCheckItems();
    CheckItem findCheckItemById(Integer id);
    void saveCheckItem(CheckItem item);
    void updateCheckItem(CheckItem item);
    void deleteCheckItemById(Integer id);
    List<CheckItem> findCheckItemsByNameAndDepartment(@Param("name") String name, @Param("department") String department);

    // 排班管理
    List<Schedule> findAllSchedules();
    void saveSchedule(Schedule schedule);
    void deleteScheduleById(Integer id);
    Schedule findScheduleById(Integer id);
    void updateSchedule(Schedule schedule);
    List<String> getAllDepartments();


    List<Registration> findRegistrationsByPatient_id(int patient_id);
    // 👇 新增：根据医生 ID 查询排班信息
    Schedule findScheduleByDoctorId(Integer doctor_id);


    //病床管理

    List<Bed> findAllBeds();

    Bed findBedById(int id);

    void saveBed(Bed bed);

    void updateBed(Bed bed);

    void deleteBedById(int id);
    List<Bed> findBedsByRoomNumber(String roomNumber);

    List<Doctor> findDoctorsByDepartment(String department);
}
